

package modelos;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;


public class Conexion{
    protected Connection conexion;
    
    public Conexion() {
        super();
    }

    public void abrirConexion(){
        try {
        	
            conexion = DriverManager.getConnection("jdbc:postgresql://localhost:5432/BD6-2", "postgres", "ead");
        } catch (SQLException ex) {
            Logger.getLogger(Conexion.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void cerrarConexion(){
        try {
        	conexion.close();
            
        } catch (SQLException ex) {
            Logger.getLogger(Conexion.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

	public Connection getConexion() {
		return conexion;
	}

    


    
}
